package library.operation;

import library.book.BookList;

import java.util.Scanner;

public class ReturnOpretation implements Opretation{
    public void work(BookList bookList) {
        System.out.println("归还图书");
        System.out.println("请输入要归还书的名字");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        for (int i = 0; i < bookList.getBooksize(); i++) {
            if(name.equals(bookList.getbooks()[i].getName())) {
                if(bookList.getbooks()[i].getBorrowed()) {
                    bookList.getbooks()[i].setBorrowed(false);
                }
            }
        }
        System.out.println("归还成功");
    }
}
